function ResetValidator() {
// modal window to allow users to reset their password //
    this.setPassword = $('#set-password');
    this.setPassword.modal({show: false, keyboard: false, backdrop: 'static'});
    this.setPasswordAlert = $('#set-password .alert');
}

ResetValidator.prototype.validatePassword = function (s) {
    var passPattern = /^[_a-zA-Z0-9_]{4,20}$/;
    if (!passPattern.test(s)) {
        this.showAlert("密码是4-20位字符，支持字母、数字和'_'组合");
        return false;
    }else{
        return true;
    }

    // if (s.length >= 6) {
    //     return true;
    // } else {
    //     this.showAlert('Password Should Be At Least 6 Characters');
    //     return false;
    // }
};

ResetValidator.prototype.showAlert = function (m) {
    this.setPasswordAlert.attr('class', 'alert alert-danger');
    this.setPasswordAlert.html(m);
    this.setPasswordAlert.show();
}

ResetValidator.prototype.hideAlert = function () {
    this.setPasswordAlert.hide();
}

ResetValidator.prototype.showSuccess = function (m) {
    this.setPasswordAlert.attr('class', 'alert alert-success');
    this.setPasswordAlert.html(m);
    this.setPasswordAlert.fadeIn(500);
}